<?php

namespace app\common\model;


use think\Model;

class RegSourceModel extends Model
{
    // 挂件时长
    const DEVICE_TYPE = [
        1 => '安卓',
        2 => '苹果',
        3 => 'PC端',
    ];


    public static function getDeviceTextAttr($value, $data)
    {
        return isset(self::DEVICE_TYPE[$data['device']]) ? self::DEVICE_TYPE[$data['device']] : '';
    }

    public function statUser()
    {
        return $this->hasOne(StatUserModel::class, 'source_id', 'source_id');
    }

    public function appdownload()
    {
        return  $this->hasOne(AppDownloadModel::class, 'source', 'source_key');
    }
    public function guild()
    {
        return  $this->hasOne(GuildModel::class, 'id', 'guild_id');
    }
}